import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../index.dart';
import 'package:leader_help/utils/util.dart';

class QuestionDetailHeader extends GetView<QuestionDetailController> {
  const QuestionDetailHeader({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    var mod = controller.state.mod;
    return Container(
      padding: EdgeInsets.all(20.r),
      color: Colors.white,
      child: Row(
        children: [
          Container(
            height: 70.r,
            width: 60.r,
            alignment: Alignment.center,
            decoration: BoxDecoration(
              color: const Color(0xffEA6054),
              borderRadius: BorderRadius.circular(3.r),
            ),
            child: Text(
              '问题\n现象',
              textAlign: TextAlign.center,
              style: pfMediumStyle(color: Colors.white, fontSize: 15.sp),
            ),
          ),
          SizedBox(
            width: 15.r,
          ),
          Expanded(
            child: SizedBox(
              height: 70.r,
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: [
                  Row(
                    children: [
                      Text(
                        mod?.title ?? '',
                        style:
                            pfSCStyle(color: ColorsUtil.title, fontSize: 17.sp),
                      ),
                      mod?.iden == null
                          ? const SizedBox()
                          : Container(
                              alignment: Alignment.center,
                              padding: const EdgeInsets.all(1),
                              margin: EdgeInsets.only(left: 5.r),
                              decoration: BoxDecoration(
                                border:
                                    Border.all(color: ColorsUtil.red, width: 1),
                              ),
                              child: Text(
                                mod!.iden!,
                                style: pfMediumStyle(
                                    color: ColorsUtil.title, fontSize: 13.sp),
                              ),
                            ),
                    ],
                  ),
                  Row(
                    children: [
                      Container(
                        color: ColorsUtil.bg,
                        padding: EdgeInsets.symmetric(
                            horizontal: 3.r, vertical: 2.r),
                        child: Text(
                          mod?.typeName ?? '',
                          style: pfMediumStyle(
                              color: ColorsUtil.subTitle, fontSize: 12.sp),
                        ),
                      ),
                      SizedBox(
                        width: 10.r,
                      ),
                      mod?.type == null
                          ? const SizedBox()
                          : Container(
                              color: ColorsUtil.pink,
                              padding: EdgeInsets.symmetric(
                                  horizontal: 3.r, vertical: 2.r),
                              child: Text(
                                mod!.type!,
                                style: pfMediumStyle(
                                    color: ColorsUtil.red, fontSize: 12.sp),
                              ),
                            )
                    ],
                  ),
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }
}
